package top.yangyitao.lockManager.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Autowired
    private LockManager lockManager;
    @RequestMapping("/")
    public String index() {
        LockSubject lockSubject = lockManager.create("sth.");
        lockSubject.lock();
        throw new RuntimeException("这里可以随便抛出异常而不处理锁，因为全局的aop里面处理了锁的释放");
        lockSubject.unlock();
        return "any question can send to email 1183609515@qq.com";
    }


}
